﻿using UnityEngine;
using System.Collections;

public class Wave : MonoBehaviour {

	public GameObject rockGenerator;
	public GameObject rockGenerator2;
	public GameObject rockGenerator3;
	public GameObject rockGenerator4;
	public GameObject rockGenerator5;

	public float timeToSpawn = 1.0f;

	private bool dead = false;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (Time.timeSinceLevelLoad >= timeToSpawn && !dead) {

			if(rockGenerator)
				((GameObject)Instantiate(rockGenerator, rockGenerator.transform.position, rockGenerator.transform.rotation)).GetComponent<RocktasticIsBorn>().StartTheHuge();

			if(rockGenerator2)
				((GameObject)Instantiate(rockGenerator2, rockGenerator2.transform.position, rockGenerator2.transform.rotation)).GetComponent<RocktasticIsBorn>().StartTheHuge();

			if(rockGenerator3)
				((GameObject)Instantiate(rockGenerator3, rockGenerator3.transform.position, rockGenerator3.transform.rotation)).GetComponent<RocktasticIsBorn>().StartTheHuge();

			if(rockGenerator4)
				((GameObject)Instantiate(rockGenerator4, rockGenerator4.transform.position, rockGenerator4.transform.rotation)).GetComponent<RocktasticIsBorn>().StartTheHuge();

			if(rockGenerator5)
				((GameObject)Instantiate(rockGenerator5, rockGenerator5.transform.position, rockGenerator5.transform.rotation)).GetComponent<RocktasticIsBorn>().StartTheHuge();

			Destroy(gameObject);
			dead = true;
		}
	}
}
